/**
 * @file LowLevel.h 
 * @author Beirnaert Simon
 * @author Thomas Debouche
 * @brief Declares the LowLevel class, which provides low level instructions to
 * the high level code.
 */

#ifndef LOWLEVEL_H
#define LOWLEVEL_H
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include "Serial.h"
using namespace std;

/**
 * @brief Provides the low level API to the program.
 */
class LowLevel{
	public:
		/** Constructor */
		LowLevel();

		/** Destructor */
		~LowLevel();

		/**
		 * @brief Tell the motors what speed to move at.
		 *
		 * @param 	int leftSpeed
		 * 		The speed the left motor must run at.
		 * 		Must be between -200 and 200.
		 * @param	int rightSpeed
		 * 		The speed the right motor must run at.
		 * 		Must be between -200 and 200.
		 * @return 0 on success, 1 on failure.
		 */
		int move(int leftSpeed, int rightSpeed);

		/**
		 * @brief Close the grip.
		 *
		 * @return 0 on success, 1 on failure.
		 */
		int grab();

		/**
		 * @brief Open the grip.
		 *
		 * @return 0 on success, 1 on failure.
		 */
		int release();
		
		/**
		 * @brief Stop the motors in case of emergency (fire, zombie, 
		 * earthquake,tsunami,meteorite, russian bomb, leper evasion, 
		 * Elisabeth 2 the Queen's death, no more sugar for the coffee).
		 *
		 * @return 0 on success, 1 on failure.
		 */
		int stop();

		/**
		 * @brief Read the distance from the front IR sensor.
		 *
		 * @return distance in millimeter. -1 on failure.
		 */
		int getDistance();
		
		/**
		 * @brief Read the voltage from the internal voltage sensor.
		 *
		 * @return voltage in millivolts. -1 on failure.
		 */
		int getVoltage();

	private:
		string s1;
		string s2;
		/**string command send to the robot*/
		string command;
		string sVoltage;
		/**return the distance sensor*/ 
		int distance;
		/**return the voltage level of the powersupply*/
		int voltage;
    		/**adres of the returned result from the robot*/
		char result[100];
		/**constructor of a Serial object*/
		Serial obj_serial; 
};

#endif
